//
//  RegistTwoViewController.m
//  Mahjong
//
//  Created by KING on 16/9/19.
//  Copyright © 2016年 swift. All rights reserved.
//

#import "RegistTwoViewController.h"
#import "Header.h"
#import "LoginViewController.h"
@interface RegistTwoViewController ()
<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *myTableView;


@end

@implementation RegistTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.myTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.myTableView.backgroundColor = [UIColor colorWithRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:1];
    [self.view addSubview:self.myTableView];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.myTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
        [self createButton];
    
    self.navigationItem.title = @"联系人";
    
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_but_back"] style:(UIBarButtonItemStyleDone) target:self action:@selector(backAction)];
    backItem.tintColor = [UIColor grayColor];
    self.navigationItem.leftBarButtonItem = backItem;
    
   
    UIBarButtonItem *tiaoItem = [[UIBarButtonItem alloc] initWithTitle:@"跳过" style:(UIBarButtonItemStyleDone) target:self action:@selector(tiaoAction)];
    tiaoItem.tintColor = [UIColor grayColor];
    self.navigationItem.rightBarButtonItem = tiaoItem;
    
}
-(void)tiaoAction{
    LoginViewController *vc = [self.navigationController.viewControllers objectAtIndex:1];
    [self.navigationController popToViewController:vc animated:YES];
    
}
- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)createButton{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, SCREENH_HEIGHT-40, SCREEN_WIDTH, 40);
    button.backgroundColor = [UIColor grayColor];
    [button setTitle:@"完成" forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(disAction:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)disAction:(UIButton *)btn{
    LoginViewController *vc = [self.navigationController.viewControllers objectAtIndex:1];
    [self.navigationController popToViewController:vc animated:YES];
    //    AddPhoneViewController *add = [[AddPhoneViewController alloc] init];
    //    [self.navigationController pushViewController:add animated:YES];
    
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        
        cell.textLabel.text = @"联系名称";
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15, 10, 10, 20)];
        image.image = [UIImage imageNamed:@"but_go.png"];
        [cell addSubview:image];
        return cell;
    }
    if (indexPath.row == 1) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        
        
        cell.textLabel.text = @"联系人";
        
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15, 10, 10, 20)];
        image.image = [UIImage imageNamed:@"but_go.png"];
        [cell addSubview:image];
        return cell;
    }
    if (indexPath.row == 2) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        
        
        cell.textLabel.text = @"所在地区";
        
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15, 10, 10, 20)];
        image.image = [UIImage imageNamed:@"but_go.png"];
        [cell addSubview:image];
        return cell;
    }
    if (indexPath.row == 3) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        
        
        cell.textLabel.text = @"街道";
        
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15, 10, 10, 20)];
        image.image = [UIImage imageNamed:@"but_go.png"];
        [cell addSubview:image];
        return cell;
    }
    else{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        
        
        cell.textLabel.text = @"详细地址";
        
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15, 10, 10, 20)];
        image.image = [UIImage imageNamed:@"but_go.png"];
        [cell addSubview:image];
        return cell;
    }
    
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 15;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
